<?php

if (!defined('BLOCK_FILE')) {
header("Location: ../index.php");
exit;
}

$name=basename(__FILE__);
if ( !cache_check($name, 300) ) {

 
$content .= "<table border=1 cellspacing=0 cellpadding=5 width=100%><tr><td class=block>"; 
$content .= "<MARQUEE behavior= \"scroll\" align=\"left\" direction= \"up\" height=\"600\" scrollamount= \"2\" scrolldelay= \"65\" onmouseover= \"this.stop()\" onmouseout='this.start()'>"; 
$res = mysql_query("SELECT id, category, seeders, image1 as poster, leechers, name, times_completed from torrents WHERE added > DATE_SUB(NOW(),INTERVAL 6 DAY) ORDER BY times_completed DESC LIMIT 6") or sqlerr(__FILE__, __LINE__); 
$num = mysql_num_rows($res); 
if ($num > 0) 
{ 
for ($i = 0; $i < $num; ++$i) 
{ 
while ($row = mysql_fetch_assoc($res)) { 
$cros = mysql_query("SELECT name, image FROM categories WHERE id=$row[category]"); 
if (mysql_num_rows($cros) == 1) 
{ 
$corr = mysql_fetch_assoc($cros); 
$cat_img = "<img src=$BASEURL/pic/cats/" . $corr[image] . " border=0 alt='$corr[name]'>"; 
} 
$content .= "<center><a href=details.php?id=$row[id]><b>$row[name]</b></a></center>"; 
$content .= "<center><a href=details.php?id=$row[id]><img alt='$row[name]' border='0' src='thumb2.php?w=147&q=60&file=$row[poster]' border=\"0\" /></a><br> <align=center><font color=red><span title=\"???????\">" .number_format($row['seeders'])."</span><font color=green><span title=\"??????\">"." ".number_format($row['leechers'])."<font color=blue><span title=\"????? ??????? ???\">"." ".number_format($row['times_completed'])."</font></center>"; 
$content .= "<p>"; 
} 
} 
}
$content .= "</marquee></td></tr></table>"; 

  cache_write($name, $content,300);
} else {
    $content=cache_read($name);
}

?>